home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / System / PPCReleaseDEV / include / powerup / ppclib / object.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-21  |  5.9 KB  |  233 lines

  1. #ifndef POWERUP_PPCLIB_OBJECT_H
  2. #define POWERUP_PPCLIB_OBJECT_H
  3.  
  4. /**************************************************
  5.  *
  6.  *
  7.  *              PPCLoadElfObjectTags()
  8.  *
  9.  *
  10.  **************************************************/
  11.  
  12. #define    PPCELFLOADOBJECTTAG_DUMMY    (TAG_USER + 0x23300)
  13.  
  14. /* pointer to a filename of the elf file */
  15. #define    PPCELFLOADTAG_ELFNAME        (PPCELFLOADOBJECTTAG_DUMMY + 0x0)
  16.  
  17. /* pointer to the elf stream resident in memory.
  18.  * PPCELFLOADTAG_ELFNAME and PPCELFLOADTAG_ELFADDRESS
  19.  * are mutually exclusive
  20.  */
  21. #define    PPCELFLOADTAG_ELFADDRESS    (PPCELFLOADOBJECTTAG_DUMMY + 0x1)
  22.  
  23. /* length of the elf stream. This tag is optional
  24.  */
  25. #define    PPCELFLOADTAG_ELFLENGTH        (PPCELFLOADOBJECTTAG_DUMMY + 0x2)
  26.  
  27. /* Stream IO Hook
  28.  * so you can implement your own loader system
  29.  * BOOL CallHookPkt(hook,Handle,&Msg);
  30.  *
  31.  */
  32. #define    PPCELFLOADTAG_HOOK        (PPCELFLOADOBJECTTAG_DUMMY + 0x3)
  33.  
  34. /* Load an ElfObject as a LibModule
  35.  * BOOL
  36.  */
  37. #define    PPCELFLOADTAG_LIBRARY        (PPCELFLOADOBJECTTAG_DUMMY + 0x4)
  38.  
  39. /* File Ptr
  40.  * BPTR
  41.  */
  42. #define    PPCELFLOADTAG_FILE        (PPCELFLOADOBJECTTAG_DUMMY + 0x5)
  43.  
  44. struct ElfStreamMsg
  45. {
  46.     ULONG    Type;
  47.     ULONG    Arg1;    /* Open->No Meaning,Close->No Meaning,Read->Address,Seek->Offset */
  48.     ULONG    Arg2;    /* Open->No Meaning,Close->No Meaning,Read->Length,Seek->Type */
  49. };
  50.  
  51. /* The Result must be a Handle */
  52. #define    PPCELFLOADTYPE_OPEN    0
  53. /* The Result must be a boolean */
  54. #define    PPCELFLOADTYPE_CLOSE    1
  55. /* The Result must be the read length or -1 */
  56. #define    PPCELFLOADTYPE_READ    2
  57. /* The Result must be the old offset or -1 */
  58. #define    PPCELFLOADTYPE_SEEK    3
  59.  
  60. /**************************************************
  61.  *
  62.  *
  63.  *              PPCGetElfInfos() Tags
  64.  *
  65.  *
  66.  **************************************************/
  67.  
  68. #define    PPCELFINFOTAG_DUMMY        (TAG_USER + 0x23000)
  69.  
  70. /* Returns the name of an elfobject */
  71. #define    PPCELFINFOTAG_NAME        (PPCELFINFOTAG_DUMMY + 0x0)
  72.  
  73. /* Returns infos about a reloc instead of a symbol
  74.  * A special PPCSymbolStruct is passed by ti_Data
  75.  * which tells if you search for a symbol name
  76.  * or wanna find a symbol for a certain address.
  77.  * Result=TRUE if the search was successful and then
  78.  * the SymbolStruct contains other important infos
  79.  */
  80. #define    PPCELFINFOTAG_RELOC        (PPCELFINFOTAG_DUMMY + 0x1)
  81.  
  82.  
  83.  
  84. /* Set this Boolean if you want the infos global.
  85.    Then all Elfobjects are searched.
  86.  */
  87. #define    PPCELFINFOTAG_GLOBAL        (PPCELFINFOTAG_DUMMY + 0x2)
  88.  
  89.  
  90. /* Define this Hook if you wanna get informations about every
  91.    Symbol in a specific ElfObject or in all.
  92.    (ElfObject==NULL || PPCELFINFOTAG_GLOBAL=TRUE)
  93.    That`s the way how the PPCGetObjectInfo() calls your hook.
  94.    MyInfo contains the passed infos, so you could show all
  95.    important symbols or relocs if possible.
  96.  
  97.    CallHookPkt(ScanSymbolHook,
  98.                (APTR) ElfSubStructure, // Not really useful
  99.                (APTR) MyInfo);
  100.  
  101.  */
  102. #define    PPCELFINFOTAG_SCANSYMBOLHOOK    (PPCELFINFOTAG_DUMMY + 0x3)
  103.  
  104.  
  105.  
  106. struct    PPCObjectInfo
  107. {
  108.     ULONG    Address;
  109. /* Name of the Object
  110.  * If this is set PPCGetElfInfo search for the Name
  111.  * Otherwise Address is used to search for an object
  112.  */
  113.     char    *Name;
  114. /* Type of the object
  115.  */
  116.     ULONG    Type;
  117.  
  118. /* Subtype of the object
  119.  * Symbol:
  120.  * COMMON=BSS
  121.  * FUNCTION
  122.  * ...
  123.  * Section:
  124.  *
  125.  * Reloc:
  126.  * Relocation Type
  127.  */
  128.     ULONG    SubType;
  129. /* Symbol:
  130.  * Local,Global,Weak
  131.  * Section:
  132.  *
  133.  */
  134.     ULONG    Binding;
  135. /* Size of the object
  136.  */
  137.     ULONG    Size;
  138. };
  139.  
  140. #define    PPCELFINFOTYPE_SECTION        0
  141.  
  142. /* A Symbol whose SubType defines the real
  143.    symbol Type and Binding contains the
  144.    state of the symbol.
  145.  */
  146. #define    PPCELFINFOTYPE_SYMBOL        1
  147.  
  148. /* A common section(BSS) symbol whose SubType
  149.    defines the real symbol Type and Binding
  150.    contains the state of the symbol.
  151.  */
  152. #define    PPCELFINFOTYPE_COMSYMBOL    2
  153.  
  154. /* A reloc entry is quite simular to a symbol.
  155.    It`s only useful to connect certain instruction
  156.    addresses with certain symbols where you can`t
  157.    calculate the symbol value in an easy way.
  158.    i.e 16 bit PPC addressmodes..ADDR16_HI,HA
  159.  */
  160. #define    PPCELFINFOTYPE_RELOC        3
  161.  
  162.  
  163.  
  164. /*------------------------------------------------------------------------*/
  165. /*  definition of the symbol types`                                            */
  166. /*------------------------------------------------------------------------*/
  167.  
  168. #define    STT_NOTYPE    0
  169. #define    STT_OBJECT    1
  170. #define    STT_FUNC    2
  171. #define    STT_SECTION    3
  172. #define    STT_FILE    4
  173. #define    STT_LOPROC    13
  174. #define    STT_HIPROC    15
  175.  
  176.  
  177. /*------------------------------------------------------------------------*/
  178. /*  definition of the symbol bindings                                        */
  179. /*------------------------------------------------------------------------*/
  180.  
  181. #define    STB_LOCAL        0
  182. #define    STB_GLOBAL        1
  183. #define    STB_WEAK        2
  184. #define    STB_LOPROC        13
  185. #define    STB_HIPROC        15
  186.  
  187.  
  188. /*------------------------------------------------------------------------*/
  189. /*  definition of the supported elf.rela types                            */
  190. /*------------------------------------------------------------------------*/
  191.  
  192. #define  R_PPC_NONE            0
  193. #define  R_PPC_ADDR32            1
  194. #define  R_PPC_ADDR24            2
  195. #define  R_PPC_ADDR16            3
  196. #define  R_PPC_ADDR16_L            4
  197. #define  R_PPC_ADDR16_HI        5
  198. #define  R_PPC_ADDR16_HA        6
  199. #define  R_PPC_ADDR14            7
  200. #define  R_PPC_ADDR14_BRTAKEN        8
  201. #define  R_PPC_ADDR14_BRNTAKEN        9
  202. #define  R_PPC_REL24            10
  203. #define  R_PPC_REL14            11
  204. #define  R_PPC_REL14_BRTAKEN        12
  205. #define  R_PPC_REL14_BRNTAKEN        13
  206. #define  R_PPC_GOT16            14
  207. #define  R_PPC_GOT16_LO            15
  208. #define  R_PPC_GOT16_HI            16
  209. #define  R_PPC_GOT16_HA            17
  210. #define  R_PPC_PLTREL24            18
  211. #define  R_PPC_COPY            19
  212. #define  R_PPC_GLOB_DAT            20
  213. #define  R_PPC_JMP_SLOT            21
  214. #define  R_PPC_RELATIVE            22
  215. #define  R_PPC_LOCAL24PC        23
  216. #define  R_PPC_UADDR32            24
  217. #define  R_PPC_UADDR16            25
  218. #define  R_PPC_REL32            26
  219. #define  R_PPC_PLT32            27
  220. #define  R_PPC_PLTREL32            28
  221. #define  R_PPC_PLT16_LO            29
  222. #define  R_PPC_PLT16_HI            30
  223. #define  R_PPC_PLT16_HA            31
  224. #define  R_PPC_SDAREL16            32
  225. #define  R_PPC_SECTOFF            33
  226. #define  R_PPC_SECTOFF_LO        34
  227. #define  R_PPC_SECTOFF_HI        35
  228. #define  R_PPC_SECTOFF_HA        34
  229.  
  230.  
  231.  
  232. #endif
  233.